
using com.byt.webcore.config;
using System.Data.Common;
namespace com.byt.webcore
{
    public class AppConfig
    {

        private static IConfig config;

        private static IConfig getInstance(ServletBase.Parameters p)
        {
            if (config == null)
                config = new AppProperties(p.req);
            return config;
        }

        public static string getServerPath(ServletBase.Parameters p)
        {
            return AppConfig.getInstance(p).getServerPath(p);
        }

        public static string getServerShared(ServletBase.Parameters p)
        {
            return AppConfig.getInstance(p).getServerShared(p);
        }

        public static DbConnection getConnection(ServletBase.Parameters p, string nombre)
        {
            return AppConfig.getInstance(p).getConnection(p, nombre);
        }

        public static string getPath(ServletBase.Parameters p, string pathName)
        {
            return AppConfig.getInstance(p).getPath(p, pathName);
        }

        public static string getEntry(ServletBase.Parameters p, string entryName)
        {
            return AppConfig.getInstance(p).getEntry(p, entryName);
        }

        public static string getHomePath()
        {
            return AppConfig.getInstance(null).getHomePath();
        }

    }
}